#!/usr/bin/env python
#coding:utf-8

from distutils.core import setup
import py2exe
import pps_config

version = pps_config.__version__
description = 'A fast proxy switcher written in Python'
name = "PyProxySwitch"
dist_dir = './bin'
includes = ["encodings", "encodings.*"]
options = {"py2exe":{
                "dist_dir": dist_dir,
                "compressed": 1,
                 "optimize": 2,
                 "includes": includes,
                 "dll_excludes": [ "MSVCP90.dll" ],
                 "bundle_files": 2
            }
           }
                 # when set to 1 will appera 'CreateActCtx' failed
                 
MANIFEST_TEMPLATE = '''
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity
    version="5.0.0.0"
    processorArchitecture="x86"
    name="%(prog)s"
    type="win32"
  />
  <description>%(prog)s</description>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel
            level="asInvoker"
            uiAccess="false">
        </requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity
            type="win32"
            name="Microsoft.VC90.CRT"
            version="9.0.21022.8"
            processorArchitecture="x86"
            publicKeyToken="1fc8b3b9a1e18e3b">
      </assemblyIdentity>
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
  </dependency>
</assembly>
'''
RT_MANIFEST = 24

setup(
    # The first three parameters are not required, if at least a
    # 'version' is given, then a versioninfo resource is built from
    # them and added to the executables.
    name = name,
    version = version,
    description = description,
    long_description = pps_config.__doc__,
    author = pps_config.__author__,
    author_email = pps_config.__email__,
    url = 'http://www.kder.info',
#    script_args = 'py2exe',
    license = pps_config.__license__,
#    comments = None,
#    file_description = description,
#    internal_name = name,
#    legal_trademarks = None,
#    original_filename = '3ProxySwitch.py',
#    private_build = None,
#    product_name = name,
#    product_version = version,
    options = options,
    zipfile = None, #'shared.lib',
    # targets to build
    windows = [{"script": "PyProxySwitch.pyw",
                "icon_resources": [(0, "PyProxySwitch.ico")
                # "icon_resources": [(1, "48.ico"),
                # (2, "32.ico"),(3, "16.ico"),(4, "256.ico")
                ],
                "other_resources" : [(RT_MANIFEST, 1,
                                        MANIFEST_TEMPLATE % dict(prog="PyProxySwitch"))],

               }
              ],
    data_files = ["MSVCR90.dll", "gdiplus.dll"],

)
